<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户反馈记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>用户ID：</label>
                                <input type="text" name="userIdentify"/>
                            </li>
                            <li>
                                <label>设备ID：</label>
                                <input type="text" name="deviceIdentify"/>
                            </li>
                            <li>
                                <label>邮箱：</label>
                                <input type="text" name="email"/>
                            </li>
                            <li>
                                <label>电话：</label>
                                <input type="text" name="mobile"/>
                            </li>
                            <li>
                                <label>QQ：</label>
                                <input type="text" name="qq"/>
                            </li>
                            <li>
                                <label>是否发送：</label>
                                <select name="isSend" th:with="type=${@dict.getType('sys_business_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>应用：</label>
                                <select name="productId" id="productId" onchange="selectProduct()">
                                    <option value="">请选择应用</option>
                                    <option th:each="product:${productList}" th:text="${product.name}" th:value="${product.id}"></option>
                                </select>
                            </li>
                            <li>
                                <label>应用版本：</label>
                                <select name="productVersion" id="productVersion">
                                    <option value="">请选择应用版本</option>
                                </select>
                            </li>
                            <li>
                                <label>手机品牌：</label>
                                <select name="phoneBrand" id="phoneBrand" >
                                    <option value="">请选择手机品牌</option>
                                    <option th:each="phoneBrand:${phoneBrandList}" th:text="${phoneBrand}" th:value="${phoneBrand}" ></option>
                                </select>
                            </li>
                            <li>
                                <label>手机型号：</label>
                                <select name="phoneModel" id="phoneModel">
                                    <option value="">请选择手机型号</option>
                                    <option th:each="phoneModel:${phoneModelList}" th:text="${phoneModel}" th:value="${phoneModel}" ></option>
                                </select>
                            </li>
                            <li>
                                <label>安卓版本：</label>
                                <select name="androidVersion" id="androidVersion">
                                    <option value="">请选择安卓版本</option>
                                    <option th:each="androidVersion:${androidVersionList}" th:text="${androidVersion}" th:value="${androidVersion}" ></option>
                                </select>
                            </li>
                            <li>
                                <label>分辨率：</label>
                                <select name="resolvingPower" id="resolvingPower">
                                    <option value="">请选择分辨率</option>
                                    <option th:each="resolvingPower:${resolvingPowerList}" th:text="${resolvingPower}" th:value="${resolvingPower}" ></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;查询</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="product:userFeedback:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="product:userFeedback:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="product:userFeedback:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="product:userFeedback:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('product:userFeedback:edit')}]];
        var removeFlag = [[${@permission.hasPermi('product:userFeedback:remove')}]];
        var yes_no = [[${@dict.getType('sys_business_yes_no')}]];
        var prefix = ctx + "product/userFeedback";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/form",
                updateUrl: prefix + "/form/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "用户反馈记录",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '${comment}',
                    visible: false
                },

                {
                    field: 'userIdentify',
                    title: '用户ID'
                },

                {
                    field: 'account',
                    title: '账号'
                },
                {
                    field: 'productName',
                    title: '应用名称'
                },
                {
                    field: 'productVersion',
                    title: '应用版本'
                },
                {
                    field: 'deviceIdentify',
                    title: '设备ID'
                },
                {
                    field: 'phoneBrand',
                    title: '手机品牌'
                },
                {
                    field: 'phoneModel',
                    title: '手机型号'
                },
                {
                    field: 'androidVersion',
                    title: '安卓版本'
                },
                {
                    field: 'resolvingPower',
                    title: '分辨率'
                },
                {
                    field: 'channelId',
                    title: '渠道'
                },
                {
                    field: 'email',
                    title: '邮箱'
                },
                {
                    field: 'sex',
                    title: '性别',
                    formatter: function(value, row, index) {
                        if (value == 0) {
                            return "女";
                        } else if (value == 1) {
                            return "男";
                        } else if (value == 2) {
                            return "未知";
                        } else {
                            return "未知";
                        }
                    }
                },
                {
                    field: 'birthday',
                    title: '出生日期'
                },
                {
                    field: 'address',
                    title: '地址'
                },
                {
                    field: 'mobile',
                    title: '电话'
                },
                {
                    field: 'qq',
                    title: 'QQ'
                },
                {
                    field: 'content',
                    title: '内容'
                },
                {
                    field: 'isSend',
                    title: '是否发送',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(yes_no, value);
                    }
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function selectProduct() {
        var productId = $("#productId").val();
        $.ajax({
            type: "GET",
            url: prefix + "/addChangeProduct?productId="+productId,
            cache: false,
            dataType: 'json',
            success: function(result) {
                if (result) {
                    var html = "<option value=''>请选择应用版本</option>";
                    for (var i = 0; i < result.length; i++) {
                        html += "<option value='" + result[i] + "'>" + result[i] + "</option>"
                    }
                   $('#version').html(html);
                } else {
                    $.modal.alertError(result.msg);
                }
            },
            error: function(error) {
                $.modal.alertWarning("失败。");
            }
        });
    }
    </script>
</body>
</html>